package org.zfes.snowier.cloud.zbss.metting.router.service.tenant;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.metting.biz.model.TenantMember;
import org.zfes.snowier.cloud.zbss.metting.biz.service.ITenantMemberService;
@Controller 
@RequestMapping("/auth/tenantMember")
public class TenantMemberController extends BaseController {

	
	@Autowired
	private ITenantMemberService tenantMemberService;
	
	@RequiresPermissions(value="tenantMember:loadTenantMemberDataSet",desc="租户信息列表")
    @RequestMapping(value="/loadTenantMemberDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadTenantMemberDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  tenantMemberService.loadTenantMemberDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="tenantMember:createTenantMember",desc="租户信息添加")
    @RequestMapping(value="/createTenantMember", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createTenantMember(TenantMember tenantMember){
		tenantMemberService.createTenantMember(tenantMember);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="tenantMember:loadTenantMember",desc="租户信息加载")
    @RequestMapping(value="/loadTenantMember", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadTenantMember(Long id){
		Optional<TenantMember> ops = tenantMemberService.loadTenantMemberById(id);
		return ajaxQuery("tenantMember",ops);
    }
	
	@RequiresPermissions(value="tenantMember:updateTenantMember",desc="租户信息更新")
    @RequestMapping(value="/updateTenantMember", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateTenantMember(TenantMember tenantMember){
		tenantMemberService.updateTenantMember(tenantMember);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="tenantMember:deletTenantMember",desc="租户信息删除")
    @RequestMapping(value="/deleteTenantMember", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteTenantMember(Long id){
		tenantMemberService.deleteTenantMember(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}